const router = require('express').Router();

const fs = require('fs');
const path = require('path');
fs.readdir('./routers',(err,data)=>{
    if(err) return console.log(err);

    console.log(data);
    data.forEach(item=>{
        if(item === 'index.js') return;
        // console.log(path.parse(item))
        const {name}  = path.parse(item);
        // router.use('/users',)
        router.use('/'+name,require('./'+name))
    });
})


module.exports = router


